/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fixture;

import com.google.inject.Guice;
import com.google.inject.Injector;
import model.MachineManager;
import model.RealMachine;
import model.VMMachine;
import module.MyModule;
import static org.mockito.Mockito.*;

/**
 *
 * @author think
 */
public class FakeMachine {
    static MachineManager mm;

    static {
        Injector injector = Guice.createInjector(new MyModule());
        mm = injector.getInstance(MachineManager.class);
    }

    public static VMMachine getMockVMMachine() throws Exception {
        VMMachine vm = mock(VMMachine.class);

        when(vm.getTsProjectArchive()).thenReturn("c:\\installer_scripts.zip");
        when(vm.getTsProjectPath()).thenReturn("c:\\installer_scripts");
        when(vm.getTsTcPath()).thenReturn("c:\\installer_scripts\\scripts");
        when(vm.hasCurrentBuildSnapshot()).thenReturn(true);
        when(vm.getInstallerPath()).thenReturn("c:\\sup_installer");

        return vm;
    }

    public static VMMachine getVMMachine() throws Exception {
        return (VMMachine) mm.getMachine("win03uepinstall");
    }

    public static RealMachine getMockTPX200() {
        RealMachine rm = mock(RealMachine.class);
        when(rm.getName()).thenReturn("think-PC");
//        when(rm.isStarted()).thenReturn(true);
        when(rm.getTsProjectArchive()).thenReturn("c:\\installer_scripts.zip");
        when(rm.getTsProjectPath()).thenReturn("C:\\Users\\think\\IBM\\rationalsdp6.0\\workspace\\demo");
        when(rm.getTsTcPath()).thenReturn("");
        when(rm.getInstallerPath()).thenReturn("c:\\sup_installer");
        return rm;
    }

    public static RealMachine getTPX200() throws Exception{
        return (RealMachine)mm.getMachine("think-PC");
    }
}
